// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
import * as echarts from 'echarts'
import FileSaver from "file-saver";
import XLSX from "xlsx";
Vue.prototype.$echarts = echarts

import axios from 'axios';
axios.defaults.baseURL="http://localhost:8888/"
axios.defaults.withCredentials=true

Vue.prototype.$axios=axios;

Vue.config.productionTip = false

function exportDataExcel(tHeader, tData, name) {
    // 注意require路径为你的vendor文件路径
    const { export_json_to_excel } = require('@/vendor/Export2Excel.js');
    const data = tData.map(v => tHeader.map(j => v[j]))
    console.log(data);
    export_json_to_excel(tHeader, data, name);
}
Vue.prototype.exportDataExcel = exportDataExcel

router.beforeEach((to,from,next)=>{
				if(to.path=="/login"){
					next()
				}else{
					var user=sessionStorage.getItem("aid")
					if(user==null){
						next("/login")
					}else{
						next()
					}

				}
			})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
